<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Person() {

        }

        function Animal() {

        }
        let person = new Person();
        let animal = new Animal();

        console.log(person.__proto__ === Person.prototype);
        console.log(animal.__proto__ === Animal.prototype);

        Person.prototype = {
            constructor: Person,
            'name': 'Mike',
            sayName: function () {
                console.log(this.name);
            }
        } 
        Animal.prototype.name = 'animal'
        Animal.prototype.sayName = function () {
            console.log(this.name);
        }
        console.log(person.__proto__ === Person.prototype);
        console.log(animal.__proto__ === Animal.prototype);

        person.sayName()
        animal.sayName();

        // https://blog.csdn.net/chengQunBin/article/details/78910943
        // 在重写原型对象的时候，
        // Person.prototype 会创建一个新的原型对象
        // 而 person.__proto__  仍然指向原来的那个旧的原型对象
    </script>
</body>

</html>